/*
 * Student.cpp
 *
 *  Created on: Nov 16, 2012
 *      Author: monitz
 */

#include "../include/Student.h"
#include "../include/Course.h"

void Student::log(std::stringstream &sstm)
{
	std::ofstream fh;
	fh.open("random.log",std::ios::app);
	if(fh.is_open())
	{
	fh << sstm.str();
	}
	fh.close();

}

Student::Student(int ID, std::string path,int ELtodo):ID(ID),semester(1),image(path),ELtodo(ELtodo),semester_succeed(true)
{

}


int Student::getID()
{
	return ID;
}
void Student::useELtodo()
{
	ELtodo--;
}
void Student::retELtodo()
{
	ELtodo++;
}

int Student::getELtodo()
{
	return ELtodo;
}
std::string Student::getImage()
{
	return image;
}
int Student::getSem()
{
	return semester;
}
void Student::resetSem()
{
	//only reset semester_succeed for spring semesters on spring semesters etc...
	if(semester%2==Course::cur_sem%2)
	semester_succeed=true;
}
bool Student::isSucc()
{
	return semester_succeed;
}
void Student::grad()
{
	if(semester_succeed)
		semester++;

}
bool Student::isDegreeGraduate(int depSemesters)
{
	if(semester_succeed && semester>=depSemesters && ELtodo == 0)
	{
		return true;
	}
	else
		return false;
}

Student::~Student()
{

}
